package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.entity.vo.BomcaVo;
import com.github.pagehelper.Page;
import com.example.entity.vo.InvmbVo;
import com.example.entity.yifei.Bomca;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author LiangPandeng
 * @since 2024-02-26
 */
public interface BomcaMapper extends BaseMapper<Bomca> {

    @DS("demo")
    Page<InvmbVo> invmbSelectPge(String ph,String pm,Character zt);


    @DS("demo")
    @Select("select MB001 mb001,MB002 mb002,MB003 mb003,MB029 mb029,INVMB.UDF01 udf01,MB009 mb009,INVMB.UDF03 udf03 ,INVMB.UDF06 udf06,CA017 ca017\n" +
            "FROM INVMB LEFT JOIN BOMCA ON MB001=CA003  ")
    List<InvmbVo> invmbSelectall();

    @DS("demo")
    @Select("SELECT LEVELS levels,ID id,MB002 mb002 ,MB003 mb003,MB004 mb004,MB014 mb014,MD006 md006 ,MD007 md007,MB025 mb025,RTRIM(INVMB.MB029) mb029,\n" +
            "INVMB.UDF01 udf01 ,'',INVMB.UDF03 udf03\n" +
            "FROM Loadbom3(#{ph})\n" +
            "LEFT JOIN INVMB ON MB001=ID\n" +
            "LEFT JOIN CMSMW ON MW001=MD009 WHERE Level<>0 ORDER BY aa")
    List<BomcaVo> selectPh(String ph);
}
